$('.product_listing_gallery_detail_cat, h2.listing_h2').hover(function(){$(this).addClass('mouse_over');}, function() {$(this).removeClass('mouse_over');});
$('.product_listing_gallery_detail_cat').live('click', function(){
var pID = $(this).closest('li').attr('id').split('_').reverse();
var full_id = $(this).closest('li').attr('id');
if($(this).closest('ul').hasClass('grid')){
	var list_type = 'grid';
}else if($(this).closest('ul').hasClass('list')){
	var list_type = 'list';
}

set_dialog();
inner = '<link rel="stylesheet" type="text/css" href="admin/includes/javascript/ui/jquery-ui-1.8.16.custom.css" media="screen, projection">';
inner += '<link rel="stylesheet" type="text/css" href="admin/includes/wysiwyg/css/elrte.min.css" media="screen, projection">';
inner += '<textarea name="products_description" id="products_description"></textarea>';
inner += '<script type="text/javascript">setTimeout("set_editor();", 800)</script>';
$('#dialog').html(inner);

$.ajax({type : 'POST',
		url : 'includes/javascript/helper/admin_inline_desc.php', 
		data: 'pID='+pID[0]+'&type='+list_type, 
		success : function(html){
			$('#products_description').html(html);
		}
});

$('#dialog').dialog({
	autoOpen:false,show:"fade",title:'Beschreibung bearbeiten',width:600,height: 350,modal:true,position:['center', 'center'],buttons:{Speichern:function(){var content=$('#products_description').elrte('val');
		var full_id=$('input[name=full_id]').val();
		var type=$('input[name=type]').val();
		var pID=$('input[name=products_id]').val();
		xajax_save_desc(pID,content,type,full_id);$(this).dialog('close');},Abbrechen:function(){$(this).dialog('close');$(".ui-dialog").remove();$("#dialog").remove();}}});$("#dialog").dialog('open');
		
xajax_get_description(pID[0], full_id, list_type);});

function set_editor(){
	var options_inline_edit={styleWithCSS:false,cssfiles:['./admin/includes/wysiwyg/css/textarea.css'],allowSource:false,height:160,toolbar:'mini'};$('#products_description').elrte(options_inline_edit);
	$('.panel-save').hide();
}

$('h2.listing_h2').live('click', function(){
	var pID = $(this).closest('li').attr('id').split('_').reverse();
	var full_id = $(this).closest('li').attr('id');
	xajax_get_name(pID[0], full_id);
	return false;
});

function set_dialog() {
	if($('#dialog').length < 1) {
		$('body').append('<div id="dialog" />');	
	}
}